#include "module_call.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>

void call_module()
{
	static int times = 1;
	int t = rand()%100;
	usleep(t*1000);	
	printf("CallModule times=%d sleep=%d\n", times, t);
	times++;
}

int main(int argc, char ** argv)
{
	srand(time(NULL));

	if (argc < 2)
	{
		printf("Usage:%s calltimes\n", argv[0]);
		return -1;
	}

	int times = atoi(argv[1]);

	for (int i = 0; i < times; i++)
	{
		modulecall::call_start();
		call_module();
		modulecall::call_end();
		printf("TimeCost=%lld\n", modulecall::call_timecost());
	}

	return 0;
}
